<?php


echo htmlspecialchars($_POST['username']);
echo htmlspecialchars($_POST['sex']);
echo htmlspecialchars($_POST['idno1']);
echo htmlspecialchars($_POST['tel']);
echo htmlspecialchars($_POST['pay1']);
echo htmlspecialchars($_POST['pay2']);
/*是代收费 汇总*/
echo htmlspecialchars($_POST['pay3']);

/*是学费 住宿费 汇总*/

echo "pay4:";
echo htmlspecialchars($_POST['pay4']);
echo "aa:";
echo htmlspecialchars($_POST['aa']);
if(isset($_POST['tel'])){
    if(empty($_POST['tel'])){
        $tel="-";
    }else{
        $tel=trim($_POST['tel']);
    }
}else{
    $tel="-";
}
$_POST['username']=trim($_POST['username']);
//console_log(htmlspecialchars($_POST['username']));
//console_log(htmlspecialchars($_POST['sex']));
//console_log(htmlspecialchars($_POST['tel']));
//console_log(htmlspecialchars($_POST['idno1']));
//console_log(htmlspecialchars($_POST['pay1']));
//console_log(htmlspecialchars($_POST['pay2']));
//console_log(htmlspecialchars($_POST['pay3']));
//console_log(htmlspecialchars($_POST['pay4']));
//console_log(htmlspecialchars($_POST['aa']));
//$ajsonObj = '{"input1":"143781","input2":"测试","input3":"15307968235","input4":"100"}';
//$str = '{"a":"123","b":"456"}';
//$jsonObj = '[{"input1":"143781","input2":"测试","input3":"15307968235","input4":"100"}]';
////首先要用 json_decode 对 JSON 格式的字符串进行编码，
//
//$datajson = json_decode($jsonObj);
//$datajson[0]->input4=htmlspecialchars($_POST['orderAmount2']);
//知行中学语链接
//旧博旺商户号JF-EPAY2021070820067
//新博旺商户号JF-EPAY2022070410005

if (htmlspecialchars($_POST['aa'])=='A'||htmlspecialchars($_POST['aa'])=='aa'){
    $_POST['aa']='学费';
    if(htmlspecialchars($_POST['pay3'])==0){
        /*如果代收费是0元，那么交了学费住宿费就是交齐*/
      $_POST['aa']='学费类';
        //$url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622738&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay4'])."%22%2C%22input5%22%3A%22A%22%7D&showBill=1";
        $url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622738&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay4'])."%22%2C%22input5%22%3A%22".htmlspecialchars($_POST['aa'])."%22%7D&showBill=1";

    }else{
        //$url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622738&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay4'])."%22%2C%22input5%22%3A%22A%22%7D&showBill=1";
        $url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622738&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay4'])."%22%2C%22input5%22%3A%22".htmlspecialchars($_POST['aa'])."%22%7D&showBill=1";

    }
}else{ //20220627由策源修改为博旺
    $_POST['aa']='学杂费';
    if(htmlspecialchars($_POST['pay4'])==0){
        /*如果代收费是0元，那么交了学费住宿费就是交齐*/
        //$url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021070820067&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay3'])."%22%2C%22input5%22%3A%22D%22%7D&showBill=1";
        $_POST['aa']='学杂费类';
        $url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2022070410005&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay3'])."%22%2C%22input5%22%3A%22".htmlspecialchars($_POST['aa'])."%22%7D&showBill=1";
    }else{
        $url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2022070410005&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay3'])."%22%2C%22input5%22%3A%22".htmlspecialchars($_POST['aa'])."%22%7D&showBill=1";

    }

}

//if (htmlspecialchars($_POST['aa'])=='A'){
//
//    if(htmlspecialchars($_POST['pay3'])==0){
//        /*如果代收费是0元，那么交了学费住宿费就是交齐*/
//        echo "PAY3===0000:";
//       // https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622738&userInput=%7B%22input1%22%3A%22%E5%8D%97%E6%98%8C%22%2C%22input2%22%3A%22320%22%2C%22input3%22%3A%22138%22%2C%22input4%22%3A%221%22%2C%22input5%22%3A%22A%22%7D&showBill=0
//      $url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622738&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay4'])."%22%2C%22input5%22%3A%22C%22%7D&showBill=1";
//
//    }else{
//
//        echo "PAY3!!=0000:";
//        echo htmlspecialchars($_POST['pay4']);
//      $url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622738&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay4'])."%22%2C%22input5%22%3A%22".htmlspecialchars($_POST['aa'])."%22%7D&showBill=1";
//    }
//}else{
//    if(htmlspecialchars($_POST['pay4'])==0){
//        //https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622739&userInput=%7B%22input1%22%3A%22%E5%8D%97%E6%98%8C%22%2C%22input2%22%3A%22320%22%2C%22input3%22%3A%22138%22%2C%22input4%22%3A%221%22%2C%22input5%22%3A%22B%22%7D&showBill=0 /*如果代收费是0元，那么交了学费住宿费就是交齐*/
//        $url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622739&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay3'])."%22%2C%22input5%22%3A%22D%22%7D&showBill=1";
//    }else{
//     $url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021071622739&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['username'])."%22%2C%22input2%22%3A%22".htmlspecialchars($_POST['idno1'])."%22%2C%22input3%22%3A%22".htmlspecialchars($tel)."%22%2C%22input4%22%3A%22".htmlspecialchars($_POST['pay3'])."%22%2C%22input5%22%3A%22".htmlspecialchars($_POST['aa'])."%22%7D&showBill=1";
//
//    }
//
//}

//博望链接


//$url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021070619659&userInput=%7B%22input1%22%3A%22%E5%8D%97%E6%98%8C%22%2C%22input2%22%3A%22320%22%2C%22input3%22%3A%22138%22%2C%22input4%22%3A%221%22%7D&showBill=0";
//$url = "https://enjoy.abchina.com/jf-web/epayItem?code=JF-EPAY2021021974667&userInput=%7B%22input1%22%3A%22".htmlspecialchars($_POST['clientType'])."%22%2C%22input2%22%3A%22%E6%B5%8B%E8%AF%95%22%2C%22input3%22%3A%2215307968235%22%2C%22input4%22%3A%2220%22%7D&showBill=2";
Header("Location:$url");
function console_log($data)  //调试输出用函数
{
    if (is_array($data) || is_object($data))
    {
        echo("<script>console.log(".json_encode($data).");</script>");
    }
    else
    {
        echo("<script>console.log(".$data.");</script>");
    }
}
?>